#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

ll hanooi(int n)
{
    if(n == 1) return 2;
    return 3 * hanooi(n-1) + 2;
}

int main(){
    ll count = 0;
    int n;
    while(cin >> n){
        cout <<  hanooi(n)<<endl;

    }
}